package com.blog;
import javax.servlet.MultipartConfigElement;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * 
 * @ClassName: HmpAdminApp
 * @author: chb
 * @date: 2018年7月5日 下午9:00:47
 * @作用：后台系统启动类
 */
@EnableTransactionManagement
@SpringBootApplication
@ServletComponentScan
@MapperScan("com.blog.dao")
public class HmpAdminApp  extends SpringBootServletInitializer {
	
	 
	public static void main(String[] args) {
		SpringApplication.run(HmpAdminApp.class, args);
	}
	
	/**
	 * 使用外置的tomcat发布 
	 */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(HmpAdminApp.class);
    }
	
    /**  
     * 文件上传配置  
     * @return  
     */  
    @Bean  
    public MultipartConfigElement multipartConfigElement() {  
        MultipartConfigFactory factory = new MultipartConfigFactory();  
        //单个文件最大  
        factory.setMaxFileSize("10240KB"); //KB,MB  
        /// 设置总上传数据总大小  
        factory.setMaxRequestSize("102400KB");  
        return factory.createMultipartConfig();  
    }  
    
    
    
}
